/**
 * 雷达图基础逻辑
 * */
// import uCharts from '@/wxcomponents/ucharts/u-charts.js';
import uCharts from '../modules/achievement/ucharts/u-charts.js';
var _self;
var canvaRadar=null;
export default {
	name: 'dictMixins',
	data() {
		return {
			cWidth:'',
			cHeight:'',
			pixelRatio:1,
		}
	},
	onLoad() {
		_self = this;
		this.cWidth=uni.upx2px(690);
		this.cHeight=uni.upx2px(500);
	},
	methods: {
		assignRadarData(data){
			let arr = [];
			if (data) {
				let categories = data.map(item => {
					arr.push(item.scores[0])
					return item.attributeName
				});
				let Radar={categories:[],series:[]};
				Radar.categories = categories;
				Radar.series = [{name: '评价', data: arr}];
				_self.showRadar("canvasRadar",Radar);
			}
		},
		showRadar(canvasId,chartData){
			canvaRadar=new uCharts({
				$this:_self,
				canvasId: canvasId,
				type: 'radar',
				fontSize:11,
				legend:{show:true},
				background:'#FFFFFF',
				pixelRatio:_self.pixelRatio,
				animation: true,
				dataLabel: true,
				categories: chartData.categories,
				series: chartData.series,
				width: _self.cWidth*_self.pixelRatio,
				height: _self.cHeight*_self.pixelRatio,
				extra: {
					radar: {
						max: 100//雷达数值的最大值
					}
				}
			});
		}
	}
}